<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <title>故事标签编辑</title>
    <link th:include="fragment/import :: import">
</head>
<body style="padding: 20px">

<form class="layui-form" id="mainForm" th:action="@{/admin/articleTag/{action}(action=${action})}"
      th:method="post" th:object="${articleTag}">
    <input name="articleTag.id" th:value="*{id}" type="hidden"/>
    <div class="layui-form-item">
        <label class="layui-form-label label-width-auto">标签名称：</label>
        <div class="layui-input-block">
            <input autocomplete="off" class="layui-input" lay-verify="required" name="text" required
                   th:field="*{text}" type="text">
        </div>
    </div>
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label label-width-auto">标签描述</label>
        <div class="layui-input-block">
            <textarea class="layui-textarea" name="description" placeholder="请输入内容" th:text="*{description}"></textarea>
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-filter="formDemo" lay-submit>立即提交</button>
            <button class="layui-btn layui-btn-primary" type="reset">重置</button>
        </div>
    </div>
</form>

<script>
    layui.use('form', function () {
        let form = layui.form;
        //监听提交
        form.on('submit(formDemo)', function (data) {
            //刷新父页面
            window.parent.location.reload();//刷新父页面
            var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
            parent.layer.close(index);
        });

    });
</script>

</body>
</html>